/**
 * This class represents a status bar GUI component
 * @author Team Love is Like Sand
 * @version 1.0
 *
 */

import javax.swing.JFrame;
import javax.swing.JTextField;

/**
 * Status bar
 * @author kushagramansingh
 * @version 1.0
 */
public class StatusBar extends JTextField {
	
	/**
	 * The player for which the status is displayed
	 */
	private static Player Player;
	
	/**
	 * Constructor to set up location of status bar in frame
	 * @param frame
	 */
	public StatusBar(JFrame frame){
		setEditable(false);
		setColumns(10);
		setBounds(10, 356, 564, 20);
		frame.getContentPane().add(this);
	}
	
	/**
	 * Updates the text in the status bar
	 */
	public void updateStatusBar(){
		setText( "" + Player.getFuel() + " range\t" + Player.getSystem()
				+ "\t" + Player.getInventory().getMoney() + " STARBUCKS\t" +
				Player.getFreeCargoSpace() + " ft^3");
	}
	
	/**
	 * Sets the player for the status bar
	 * @param p
	 */
	public static void setPlayer(Player p){
		Player = p;
	}
}
